class CreateRequirements < ActiveRecord::Migration
  def self.up
    create_table :requirements, :force => true do |t|
      t.integer :user_id                    # user send this requirement
      t.string  :title, :limit => 50        # requirement title
      t.text    :content                    # requirement content
      t.integer :retype_id                  # requirement type eg. lights furniture
      t.integer :expiration, :limit => 1, :default => 0  # 0 one week, 1 two weeks, 2 one month, 3 two months
      t.integer :is_ok,      :limit => 1, :default => 0  # 0 requirement can't be sent otherwise 1
      t.integer :click_times, :default => 0              # page view times

      t.timestamps
    end
    
    create_table :retypes, :force => true do |t|
      t.string :name        # requirements type
      t.string :level       # requirements level one id
      
      t.timestamps
    end
  end

  def self.down
    drop_table :requirements
    drop_table :retypes
  end
end
